package com.xqls.ssm005.controller;

import com.xqls.ssm005.config.Config;
import com.xqls.ssm005.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Date;

@Controller
public class HelloController {

    @Resource
    private Config config;

    @Autowired
    public HelloService helloService;
    @RequestMapping("/")
    public String hello(String name){
        return "index";
    }

    @RequestMapping("/hello")
    @ResponseBody
    public Date say(Date date){
        return date;
    }

    @RequestMapping("/config")
    @ResponseBody
    public String config(){
        System.out.println(this.config);
        return config.toString();
    }

}
